/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jpaintball;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

/**
 *
 * @author ondra
 */
public class NetworkServerThread extends Thread {

    Socket socket;
    BufferedReader in;
    PrintWriter out;
    private String inputLine;

    NetworkServerThread(Socket s) {

        socket = s;

    }
    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            out = new PrintWriter(socket.getOutputStream());
            out.println("Hello! This is JPaintball server.");
            out.flush();
            System.out.println("Outputed hello message");
            while((inputLine = in.readLine()) != null) {
                out.println(inputLine);
                System.out.println("Outputed echo");
            }
        } catch (IOException ex) {
            System.out.println("Problem");
        }


    }


}
